/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * ErrorOccuredDialog.java
 *
 * Created on 12-01-2011, 22:12:51
 */

package UILayer;

import java.util.logging.Level;
import java.util.logging.LogRecord;
import java.util.logging.Logger;

/**
 *
 * @author Moulde
 */
public class ErrorOccuredDialog extends javax.swing.JDialog {

    //LogRecord record;

    /** Creates new form ErrorOccuredDialog */
    public ErrorOccuredDialog(java.awt.Frame parent, boolean modal) { //, LogRecord record) {
        super(parent, modal);
        initComponents();
        //this.record = record;
        
        txtErrorText.setText("Error occurred");//record.getLoggerName() + "\n" + record.getMessage());
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        txtErrorText = new javax.swing.JTextArea();
        btnSendErrorReport = new javax.swing.JButton();
        btnContinue = new javax.swing.JButton();
        lblErrorReportStatus = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        jLabel1.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/UILayer/resources/error.gif"))); // NOI18N
        jLabel1.setText("Der skete en fejl");
        jLabel1.setName("jLabel1"); // NOI18N

        jScrollPane1.setName("jScrollPane1"); // NOI18N

        txtErrorText.setColumns(20);
        txtErrorText.setRows(5);
        txtErrorText.setName("txtErrorText"); // NOI18N
        jScrollPane1.setViewportView(txtErrorText);

        btnSendErrorReport.setText("Send fejlrapport");
        btnSendErrorReport.setName("btnSendErrorReport"); // NOI18N
        btnSendErrorReport.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSendErrorReportActionPerformed(evt);
            }
        });

        btnContinue.setText("Fortsæt");
        btnContinue.setName("btnContinue"); // NOI18N
        btnContinue.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnContinueActionPerformed(evt);
            }
        });

        lblErrorReportStatus.setName("lblErrorReportStatus"); // NOI18N

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(btnSendErrorReport)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(lblErrorReportStatus)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(btnContinue))
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 314, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(89, 89, 89)
                        .addComponent(jLabel1)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(18, 18, 18)
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 141, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(btnContinue)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(btnSendErrorReport)
                        .addComponent(lblErrorReportStatus)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btnContinueActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_btnContinueActionPerformed
    {//GEN-HEADEREND:event_btnContinueActionPerformed
        this.setVisible(false);
    }//GEN-LAST:event_btnContinueActionPerformed

    private void btnSendErrorReportActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_btnSendErrorReportActionPerformed
    {//GEN-HEADEREND:event_btnSendErrorReportActionPerformed
        try
        {
            Thread.sleep(500);
            lblErrorReportStatus.setText("Fejlrapport er sendt");
        }
        catch (InterruptedException ex)
        {
            Logger.getLogger(ErrorOccuredDialog.class.getName()).log(Level.WARNING, null, ex);
        }
    }//GEN-LAST:event_btnSendErrorReportActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnContinue;
    private javax.swing.JButton btnSendErrorReport;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JLabel lblErrorReportStatus;
    private javax.swing.JTextArea txtErrorText;
    // End of variables declaration//GEN-END:variables

}
